<%-- 
    Document   : product_list
    Created on : Mar 11, 2013, 5:06:10 PM
    Author     : duonghung1369
--%>

<%@tag description="product list " pageEncoding="UTF-8"%>

<%-- The list of normal or fragment attributes can be specified here: --%>
<%@taglib uri="/struts-tags" prefix="s" %>

<%-- any content can be specified here e.g.: --%>
<s:iterator value="products" status="productStatus" id="product">
    <div class="product-block">
        <s:if test="#session.logined == true">
            <s:if test="#session.isadmin == false">
                <div class="add-to-cart hidden">
                    <a href="javascript:void(0)" onclick="addCart(<s:property value="id" />, '<s:property value="name" />', '<s:property value="description" />', <s:property value="quantity" />, <s:property value="price" />, '<s:property value="images[0].url" />', this);"></a>
                    <!--a href="#" onclick="ajaxAddToCart(<!--s:property value="id"/>, '<--s:property value="name"/>', '<--s:property value="description"/>', '<--s:property value="price"/>')">Add to cart</a-->
                </div>
            </s:if>
        </s:if>
        <s:else>
            <div class="add-to-cart hidden">
                <a href="javascript:void(0)" onclick="addCart(<s:property value="id" />, '<s:property value="name" />', '<s:property value="description" />', <s:property value="quantity" />, <s:property value="price" />, '<s:property value="images[0].url" />', this);"></a>
                <!--a href="#" onclick="ajaxAddToCart(<!--s:property value="id"/>, '<--s:property value="name"/>', '<--s:property value="description"/>', '<--s:property value="price"/>')">Add to cart</a-->
            </div>
        </s:else>
        <div class="product-block-image">
            <s:if test="#product.images.size() > 0">
                <s:iterator status="imageStatus" value="images" id="image">
                    <s:if test="!#image.isBigsize">
                        <a href="../product/detail.html?id=<s:property value="#product.id" />"><img src="<s:property value="url" />" alt="product image" /></a>
                        </s:if>
                    </s:iterator>
                </s:if>
                <s:else>
                <a href="../product/detail.html?id=<s:property value="id" />"><img src="" alt="product image" /></a>
                </s:else>
        </div>
        <div style="position: absolute; bottom: 0">
            <a class="product-block-information" href="../product/detail.html?id=<s:property value="id" />">
                <div class="item-information">
                    <p class="item-information-name"><s:property value="name" /></p>
                    <p class="item-information-price">Product price ($): <s:property value="price" /></p>
                    <p>Product Quantity: <span class="item-information-quantity"><s:property value="quantity" /></span></p>
                    <p class="item-information-id" style="display: none"><s:property value="id" /></p>
                </div>
            </a>
        </div>
    </div>
</s:iterator>